﻿Public Class CustomerController
    Inherits BaseController(Of Customer)
    Public Shared Function Login(ByVal Account As String, ByVal Password As String) As Customer
        Dim query = (From cust In dbo.Customers _
                    Where cust.Account Is Account _
                    AndAlso cust.Password Is ConvertHelper.ToMD5(Password) _
                    Select cust).Take(1).SingleOrDefault()
        If query IsNot Nothing Then
            Return query
        Else
            Return Nothing
        End If
    End Function

    Public Shared Function loadByEmail(ByVal Email As String) As Customer
        Dim query = (From cust In dbo.Customers _
                    Where cust.Email Is Email _
                    Select cust).Take(1).SingleOrDefault()
        If query Is Nothing Then
            Return Nothing
        Else : Return query
        End If
    End Function
End Class
